/**
 * @format
 * @Author: TC
 * @Date: 2025-07-28 16:34:03
 * @Last Modified by: TC(tengchao@taqu.cn)
 * @Last Modified time: 2025-11-10 10:19:06
 */

import { gameMgr } from "db://assets/FrameWork/Manager/GameManager";
import { app } from "../../../../FrameWork/App";
import { ShaderCasePreloadManager } from "./Manager/ShaderCasePreloadManager";
import { ShaderCaseUIConfig } from "./Const/ShaderCaseUIConst";
import { ShaderCaseCfgManager } from "./Manager/ShaderCaseCfgManager";
import { ShaderCaseGlobalManager } from "./Manager/ShaderCaseGlobalManager";

/**
 * shader案例入口
 */
class GameShaderCase {
    /**
     * 开始
     */
    public start(): void {
        gameMgr.getCurrGameConfig().gameIns = this;
    }

    /**
     * 配置管理
     */
    private _cfgMgr: ShaderCaseCfgManager;
    public get cfgMgr(): ShaderCaseCfgManager {
        return this._cfgMgr || (this._cfgMgr = new ShaderCaseCfgManager());
    }

    /**
     * 预加载管理
     */
    private _preloadMgr: ShaderCasePreloadManager;
    public get preloadMgr(): ShaderCasePreloadManager {
        return this._preloadMgr || (this._preloadMgr = new ShaderCasePreloadManager());
    }

    /**
     * 全局数据管理
     */
    private _globalMgr: ShaderCaseGlobalManager;
    public get globalMgr(): ShaderCaseGlobalManager {
        return this._globalMgr || (this._globalMgr = new ShaderCaseGlobalManager());
    }

    /**
     * 释放游戏管理
     */
    public release(): void {
        this._preloadMgr?.release();
        this._preloadMgr = null;
        this._cfgMgr?.release();
        this._cfgMgr = null;
        this._globalMgr?.release();
        this._globalMgr = null;
        app.uiMgr.removeUICfg(ShaderCaseUIConfig);
    }
}
export const gameShaderCase = new GameShaderCase();
